import { GET_ITEM_OBJ, GET_SWIPER_ARR, GET_JIESHAO_LIST } from '../content'
import axios from 'axios'

export function fetchItemData(ptKey) {
    return dispatch => {
        // let ptKey = this.props.match.params.id;
        axios.post('https://srv.hotkidceo.com/appapi/root-ceo-commodity/commodityApi/commodityDetail', { "ptKey": ptKey, "memberKey": "", "isWholeSale": 0, "channelId": null })
            .then(res => {
                dispatch({
                    type: GET_ITEM_OBJ, data: res.data.data
                });
                dispatch({
                    type: GET_SWIPER_ARR, data: res.data.data.templateInfo.bannerImages.split(',')
                });
                dispatch({
                    type: GET_JIESHAO_LIST, data: res.data.data.templateInfo.detailImages.split(',')
                });

            })
    }
}